package com.springmvc.cto51.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * HelloController--SpringMVC-test
 *
 * @author: Jovi
 * @createTime: 2018-08-16 15:59
 **/
@Controller
@RequestMapping("/hello")
public class HelloWorldController {

    /**
     * 1.使用@RequestMapping注解来映射请求的注解
     * 2.返回值会通过视图解析器解析为实际的物理视图，对于InternalResourceViewResolver视图解析器，
     * 会做如下的解析：
     * prefix + returnVal + suffix，这样的方式得到实际的物理视图，然后做转发操作
     * @param userName
     * @param model
     * @return
     */
    @RequestMapping("/cto.do")
    public String hello(String userName, Model model) {
        System.out.println(userName);
        model.addAttribute("hello1", "hello,你好:" + userName);
        return "main";
    }

}
